﻿@model cloudscribe.Core.Web.ViewModels.SiteUser.UserInfoViewModel
@using cloudscribe.Core.Web
@using Microsoft.Extensions.Options
@using Microsoft.Extensions.Localization
@inject IStringLocalizer<CloudscribeCore> sr
@{
    ViewData["Title"] = sr["Update User Info"];
    ViewData["BodyClass"] = "manage-section user-info";
}
@section Styles {
@{await Html.RenderPartialAsync("UserInfoStylePartial"); }
}
<h2>@ViewData["Title"]</h2>
<form asp-controller="Manage" asp-action="UserInfo" method="post" class="form-horizontal" role="form">
    <div asp-validation-summary="All" class="text-danger"></div>
    @if (string.IsNullOrWhiteSpace(Model.FirstName))
    {
        <div class="form-group">
            <label asp-for="FirstName" class="col-md-2 control-label">@sr["First Name"]</label>
            <div class="col-md-10">
                <input asp-for="FirstName" class="form-control" />
            </div>
        </div>
    }
    else
    {
        <div class="form-group">
            <label asp-for="FirstName" class="col-md-2 control-label">@sr["First Name"]</label>
            <div class="col-md-10">
                <input asp-for="FirstName" type="hidden" />
                <span class="form-control">@Model.FirstName</span>
            </div>
        </div>
    }
@if (string.IsNullOrWhiteSpace(Model.LastName))
{
    <div class="form-group">
        <label asp-for="LastName" class="col-md-2 control-label">@sr["Last Name"]</label>
        <div class="col-md-10">
            <input asp-for="LastName" class="form-control" />
        </div>
    </div>
}
else
{
    <div class="form-group">
        <label asp-for="LastName" class="col-md-2 control-label">@sr["Last Name"]</label>
        <div class="col-md-10">
            <input asp-for="LastName" type="hidden" />
            <span class="form-control">@Model.LastName</span>
        </div>
    </div>
}
    <div class="form-group">
        <label asp-for="PhoneNumber" class="col-md-2 control-label">@sr["Phone Number"]</label>
        <div class="col-md-10">
            <input asp-for="PhoneNumber" class="form-control" />
            <span asp-validation-for="PhoneNumber" class="text-danger"></span>
        </div>
    </div>
 @{await Html.RenderPartialAsync("UserInfoDobPartial", Model); }

    <div class="form-group">
        <label asp-for="WebSiteUrl" class="col-md-2 control-label">@sr["Website Url"]</label>
        <div class="col-md-10">
            <input asp-for="WebSiteUrl" class="form-control" />
        </div>
    </div>

    @{await Html.RenderPartialAsync("UserInfoMiddlePartial", Model); }
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <button name="submit" type="submit" class="btn btn-default">@sr["Update"]</button>
        </div>
    </div>
</form>
@section Scripts {
    @{await Html.RenderPartialAsync("UserInfoScriptsPartial"); }
}
